`ifndef MY_SEQUENCE_SVH
`define MY_SEQUENCE_SVH
class my_sequence extends uvm_sequence #(my_transaction);
    my_transaction m_trans;
    `uvm_object_utils(my_sequence)
    // Why name without default value is wrong
    //function new(string name);
    function new(string name = "my_sequence");
        super.new(name);
        // The function replace the starting_phase(include opreations) in UVM-1.2
        // It seems NOT recommanded
        set_automatic_phase_objection(1);
    endfunction

    virtual task body();
        // UVM-1.2 Does NOT support the features
        //if(starting_phase != null)
        //    starting_phase.raise_objection(this);
        repeat(10)begin
            `uvm_do(m_trans)
            // The following codes can replace <uvm_do>,
            // which are introduced in 6.3.4
            //m_trans = new("m_trans");
            //start_item(m_trans);
            //assert(m_trans.randomize() with {pload.size == 200;});
            //finish_item(m_trans);
        end
        #1000;
        //if(starting_phase != null)
        //    starting_phase.drop_objection(this);
    endtask
endclass

class case0_sequence extends uvm_sequence #(my_transaction);
    my_transaction m_trans;
    `uvm_object_utils(case0_sequence)
    // Why name without default value is wrong
    //function new(string name);
    function new(string name = "case0_sequence");
        super.new(name);
        // The function replace the starting_phase(include opreations) in UVM-1.2
        // It seems NOT recommanded
        set_automatic_phase_objection(1);
    endfunction

    virtual task body();
        // UVM-1.2 Does NOT support the features
        //if(starting_phase != null)
        //    starting_phase.raise_objection(this);
        repeat(2)begin
            //`uvm_do_with(m_trans, {m_trans.tload.size() == 1; m_trans.is_vlan == 1;})
            // The following codes can replace <uvm_do>,
            // which are introduced in 6.3.4
            m_trans = new("m_trans");
            start_item(m_trans);
            assert(m_trans.randomize() with {is_vlan == 1;})begin
                `uvm_info(this.get_type_name(), "Randomize Successed", UVM_LOW)
            end else begin
                `uvm_fatal(this.get_type_name(), "Randomize Failed")
            end
            finish_item(m_trans);
        end
        #1000;
        //if(starting_phase != null)
        //    starting_phase.drop_objection(this);
    endtask
endclass

class case1_sequence extends uvm_sequence #(my_transaction);
    my_transaction m_trans;
    `uvm_object_utils(case1_sequence)
    // Why name without default value is wrong
    //function new(string name);
    function new(string name = "case1_sequence");
        super.new(name);
        // The function replace the starting_phase(include opreations) in UVM-1.2
        // It seems NOT recommanded
        set_automatic_phase_objection(1);
    endfunction

    virtual task body();
        // UVM-1.2 Does NOT support the features
        //if(starting_phase != null)
        //    starting_phase.raise_objection(this);
        repeat(10)begin
            `uvm_do_with(m_trans, {m_trans.pload.size() == 60;})
            // The following codes can replace <uvm_do>,
            // which are introduced in 6.3.4
            //m_trans = new("m_trans");
            //start_item(m_trans);
            //assert(m_trans.randomize() with {pload.size == 200;});
            //finish_item(m_trans);
        end
        #1000;
        //if(starting_phase != null)
        //    starting_phase.drop_objection(this);
    endtask
endclass
`endif
